﻿//Xac dinh vi tri cho cac nut
back_related_film_ins._visible=false;
next_related_film_ins._visible=false;
//related_loading_progress._visible=false;
my_related_movie0._visible=false;
var played_tween:mx.transitions.Tween;
var run_tween:mx.transitions.Tween;
var quang_cao_dau:Boolean=false;
var film_name:String="";
//CAC KHAI BAO CHO VIEC HIEN THI CAC MOVIE LIEN QUAN SAU KHI CHOI HET MOT MOVIE
var image_dir:String = 'image/';
//var image_dir:String = 'http://sieuthicaycanh.com/test/ad/';
var id_arr =new Array;
var name_arr =new Array;
var display_arr =new Array;
var length_arr =new Array;
var author_arr =new Array;
var image_arr =new Array;
var star_score_arr =new Array;
var my_full_mode:Number=0;
var num_of_film:Number;
loading_progress_ins._width=0;
//THONG TIN VE HOST
//Bien luu giu trang thai cua quang cao luc cuoi
var end_ad:Boolean=false;
//Bien luu giu trang thai cua quang cao luc dau
var start_ad:Boolean=false;
//TAO KET NOI DEN NETCONNECTION
/*my_cn.onStatus = function(infoObj){
	if (infoObj.code == "NetConnection.Connect.Success" && my_cn.isConnected)
		trace("We are connected");
	else
		trace("khong duoc. roi");

};*/
//BIEN BAO LOI HE THONG
var error_occurr:Boolean=false;

var qc_dau:Boolean		= false;
var qcd_name:String		= qc_dau_name;
var qcd_length:Number	= qc_dau_length;
var qcd_type:String		= qc_dau_type;
var qc_cuoi:Boolean		= false;
var qcc_name:String		= qc_cuoi_name;
var qcc_length:Number	= qc_cuoi_length;
var qcc_type:String		= qc_cuoi_type;

//KHAI BAO CAC BIEN TOAN CUC
//CO DIEU KHIEN THANH TRUOT DE TUA DI TUA LAI KHONG
var slide_is_in_used:Boolean=false;
//QUANG CAO DANG CHAY
var ad_is_playing:Boolean = false;
//DAY LA MAY BIEN LUU CHO QUANG CAO DANG FLASH BEN NGOAI

//TONG THOI GIAN VIDEO DA CHAY
var total_time:Number = 0;
//VIDEO CO DANG BI TAM DUNG KHONG
var is_pause:Boolean=false;
//TOA DO DIEM CUOI CUA THANH TRUOT DE TUA DI TUA LAI VIDEO
//TONG DO DAI DOAN PHIM
var movie_length:Number=221;
//THOI DIEM DE XEN QUANG CAO
//TONG DO DAI DOAN PHIM BAO GOM MOVIE + QUANG CAO
if (film_name1 == undefined) {
	film_name = "DancingQueen-ABBA.flv";
	video_length=221;
} else {
	film_name = film_name1;
	video_length=film_length;
}

//HIEN THI TONG DO DAI VIDEO TREN TEXT	
var minute_length=Math.floor(video_length/60);
var second_length:Number = video_length%60;
var second_string:String;
if (second_length<10)
	second_string  = "0" + String(second_length);
else
	second_string  = String(second_length);
if(minute_length<10)
	_root.time_region.total_time_str.htmlText= "0"+String(minute_length)+":" + second_string;	
else
	_root.time_region.total_time_str.htmlText= String(minute_length)+":"+ second_string;
//TRANG THAI THANH TRUOT CO BI NGUOI DUNG DIEU KHIEN
var slide_in_used:Boolean=false;
//TRANG THAI THANH TRUOT VOLUME CO BI NGUOI DUNG DIEU KHIEN
var volume_slide_in_used:Boolean=false;
var my_streaming_server:String=streaming_server;
var my_nc:NetConnection = new NetConnection();
if(qcd_name!=undefined)
{
	var start_ad_nc:NetConnection = new NetConnection();
	start_ad_nc.connect(null);
	var start_ad_stream: NetStream= new NetStream(start_ad_nc);
}
if(qcc_name!=undefined)
{
	var end_ad_nc:NetConnection = new NetConnection();
	end_ad_nc.connect(null);
	var end_ad_stream:NetStream= new NetStream(end_ad_nc);
}
my_nc.connect(null);
var stream_ns:NetStream = new NetStream(my_nc);
stream_ns.setBufferTime(2);
//TAO MOT DOI TUONG DE DIEU KHIEN AM THANH
this.createEmptyMovieClip("flv_mc", this.getNextHighestDepth());
var audio_sound:Sound = new Sound(flv_mc);
audio_sound.setVolume(100);
//CHO CHAY DOAN PHIM MAC DINH
//Thoi gian doc dong ho, tinh bang giay
var time_interval:Number=1;
//Thoi gian de dat dong ho trong xu ly, bang thoi gian dong ho * 1000;
var time_interval_ms:Number=1000*time_interval;
//DUNG HAM setInteval DE THUC HIEN VIEC IN DONG HO
var ad:Boolean=false;
var related_film_count:Number=0;
//slide quang cao
var related_film_enable:Boolean=false;
var total_change:Number=0;
var quang_cao_loaded=false;
var my_film_name1:String="";
var my_film_name2:String="";
var my_film_id1:Number;
var my_film_id2:Number;
var my_film_length1:Number=0;
var my_film_length2:Number=0;
var button_is_pause:Boolean = false;